<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑管理员</title>
</head>
<body>
    <div th:fragment="content">
        <div class="container-fluid">
            <div class="row justify-content-center">
                <div class="col-md-8">
                    <div class="card">
                        <div class="card-header">
                            <h5 class="card-title mb-0">编辑管理员</h5>
                        </div>
                        <div class="card-body">
                            <!-- 使用传统表单提交 -->
                            <form th:action="@{'/admin/edit-admin/' + ${admin.userId}}" method="post" id="editAdminForm">
                                <input type="hidden" name="userId" th:value="${admin.userId}">
                                <div class="mb-3">
                                    <label for="username" class="form-label">用户名</label>
                                    <input type="text" class="form-control" id="username" name="username" th:value="${admin.username}" readonly>
                                </div>
                                <div class="mb-3">
                                    <label for="password" class="form-label">密码（留空表示不修改）</label>
                                    <input type="password" class="form-control" id="password" name="password">
                                </div>
                                <div class="mb-3">
                                    <label for="phone" class="form-label">电话</label>
                                    <input type="tel" class="form-control" id="phone" name="phone" th:value="${admin.phone}">
                                </div>
                                <div class="mb-3">
                                    <label for="email" class="form-label">邮箱</label>
                                    <input type="email" class="form-control" id="email" name="email" th:value="${admin.email}">
                                </div>
                                <div class="mb-3">
                                    <label for="status" class="form-label">状态</label>
                                    <select class="form-control" id="status" name="status">
                                        <option value="active" th:selected="${admin.status == 'active'}">正常</option>
                                        <option value="frozen" th:selected="${admin.status == 'frozen'}">禁用</option>
                                    </select>
                                </div>
                                <div class="d-flex justify-content-between">
                                    <a href="/admin/admin-management" class="btn btn-secondary">取消</a>
                                    <button type="submit" class="btn btn-primary">保存更改</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
